test(ts-plugin): split diagnostics and file-operation e2e tests#381
Conversation
…per-behavior cases Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…test Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…e representative case Exhaustive coverage of core checker diagnostic kinds is owned by packages/core/src/checker.test.ts. The e2e test now keeps only one representative case to verify that a CSS-side diagnostic surfaces in tsserver via ts-plugin. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…t to focus on the behavior Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…le representative case Exhaustive coverage of parser-side diagnostic kinds is owned by the parser tests under packages/core/src/parser/. The e2e test now keeps only one representative case to verify that a CSS-side syntactic diagnostic surfaces in tsserver via ts-plugin. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… diagnostic updates Restore the original 1-test-per-file-operation structure and rename each test to focus on the behavior being verified: that adding, modifying, or removing a CSS module updates the importer's diagnostics. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
There was a problem hiding this comment.
Pull request overview
Refactors the ts-plugin e2e suite toward smaller, behavior-focused fixtures and adds hover coverage so tsserver quickinfo is exercised alongside diagnostics and file-operation flows. This fits the ongoing test-suite cleanup work in the ts-plugin package by making individual behaviors easier to isolate and extend.
Changes:
- Split semantic and syntactic diagnostics e2e tests into smaller representative cases.
- Reworked file-operation e2e coverage into per-scenario tests for add/update/remove flows.
- Added a new hover e2e test and a
sendQuickInfotsserver helper to exercise quickinfo.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/ts-plugin/e2e-test/test-util/tsserver.ts |
Adds a sendQuickInfo helper for tsserver requests used by the new hover coverage. |
packages/ts-plugin/e2e-test/file-operation.test.ts |
Rewrites file-operation coverage into smaller add/update/remove test cases. |
packages/ts-plugin/e2e-test/feature/syntactic-diagnostics.test.ts |
Narrows syntactic diagnostics e2e coverage to a single representative CSS parse error. |
packages/ts-plugin/e2e-test/feature/semantic-diagnostics.test.ts |
Splits semantic diagnostics coverage into a TS-side styles access error and a CSS-side semantic error. |
packages/ts-plugin/e2e-test/feature/hover.test.ts |
Adds new quickinfo-based hover coverage for CSS module token types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This reverts commit c3f8e95.
…antic-diagnostics e2e
Replaces the reverted hover-based check with a structural type
assignment (`type Expected = { a_1: string }; const _t: Expected = styles;`)
inside semantic-diagnostics.test.ts. This avoids hard-coding the
TypeScript compiler's hover wording while still exercising the
.d.ts-generated type on the styles binding.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Refactor
packages/ts-plugin/e2e-test/feature/{semantic,syntactic}-diagnostics.test.tsandpackages/ts-plugin/e2e-test/file-operation.test.tsso that eachtestblock owns a minimal fixture and asserts a single behavior.This is the 4th PR of a multi-PR series (see #378 for the first PR / overall context).
What's new
packages/ts-plugin/e2e-test/feature/semantic-diagnostics.test.ts: rewritten as 3 behavior-focused tests:TS2339access on the styles binding;type Expected = { a_1: string }; const _t: Expected = styles;) that verifies the.d.ts-generated token map is exposed on the styles binding (replaces the oldconst t1: Expected = styles; const t2: typeof styles = t1;check that lived inside the original 1-test fixture);@import. Exhaustive coverage of every diagnostic kind lives inpackages/core/src/checker.test.ts.packages/ts-plugin/e2e-test/feature/syntactic-diagnostics.test.ts: rewritten as 1 representative test for a CSS-side syntactic diagnostic (@value;). Exhaustive coverage lives in the parser tests underpackages/core/src/parser/.packages/ts-plugin/e2e-test/file-operation.test.ts: rewritten so each describe (when adding,when updating,when removinga CSS module) owns 1 test focused on whether the importer's diagnostic is updated.when addingretains the original tsserver caching bug as aNOTE.Test structure
Total: 6 tests + 1 todo × 2 variants = 12 tests + 2 todo.
Test plan
vp test --project e2e packages/ts-plugin/e2e-test/feature/syntactic-diagnostics.test.ts— 2 passedvp test --project e2e packages/ts-plugin/e2e-test/feature/semantic-diagnostics.test.ts— 6 passedvp test --project e2e packages/ts-plugin/e2e-test/file-operation.test.ts— 4 passed + 2 todovp test --project e2e(full e2e suite) — no regressionsvp check(format + lint + type) — pass for changed files🤖 Generated with Claude Code